﻿namespace KseCms.Application
{
    public class PayMethodFactory
    {
        private readonly PaymentDto payment;

        private Dictionary<PaymentMod, IPayBase> factoryContainer;
        public PayMethodFactory(PaymentDto payment) 
        {
            this.payment = payment;

            factoryContainer = new Dictionary<PaymentMod, IPayBase>
            {
                { PaymentMod.WechatPay, new WechatPay() },
                { PaymentMod.AliPay, new AliPay() },
                { PaymentMod.UnionPay, new UnionPay() }
            };
        }

        public IPayBase CreatInstance()
        { 
           return factoryContainer[payment.PaymentMethod];
        }
    }
}
